import request from './request.js'

//包间模块接口集合

/**
 * 分页查询包间
 * 查询：可按标题搜索
 * 排序：可按课程开始时间、课程创建时间、课程修改时间、课程费用进行升序和降序排序
 * 分类：可按课程状态进行分类。
 */
export const getRoomsPage = (searchParams) => {
	return request.post('/rooms/page', searchParams)
}

/**
 * 创建包间
 */
export const insertRooms = (rooms) => {
	return request.post('/rooms', rooms)
}

/**
 * 上传包间图片
 */
export const uploadRoomsImages = (formData) => {
	return request.post('/rooms/image', formData, {
		headers: {
			'Content-Type': 'multipart/form-data'
		}
	})
}

/**
 * 批量删除包间
 */
export const deleteListRooms = (ids) => {
	return request.delete('/rooms', {
		data: ids
	})
}

/**
 * 修改包间
 */
export const updateRooms = (rooms) => {
	return request.put('/rooms', rooms)
}

/**
 * 获取包间详情
 */
export const getRoomDetail = (id) => {
	return request.get(`/rooms/${id}`)
}

/**
 * 删除图片
 */
export const deleteImage = (id) => {
	return request.delete(`/rooms/image/${id}`)
}

/**
 * 设置不可预约的时间
 */
export const saveUnavailableDate = (UnavailableDate) => {
	return request.post('/rooms/unavailableDate', UnavailableDate)
}

/**
 * 删除不可预约的时间
 */
export const deleteUnavailableDate = (id) => {
	return request.delete(`/rooms/unavailableDate/${id}`)
}